home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
WINPROGS
/
WINSRC20.ZIP
/
DIALOG2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-20
|
40KB
|
1,176 lines
/*
various dialog-box code - more in DIALOG.C
*/
#include "windows.h"
#include "winfract.h"
#include "fractint.h"
#include <math.h>
#include <stdio.h>
extern HWND hwnd; /* handle to main window */
extern char szHelpFileName[]; /* Help file name*/
extern BOOL zoomflag; /* TRUE is a zoom-box selected */
extern char *win_choices[];
extern int win_numchoices, win_choicemade;
int CurrentFractal;
extern HANDLE hDibInfo; /* handle to the Device-independent bitmap */
extern LPBITMAPINFO pDibInfo; /* pointer to the DIB info */
extern int time_to_restart; /* time to restart? */
extern int time_to_reinit; /* time to reinit? */
extern int time_to_cycle; /* time to cycle? */
extern int xdots, ydots, colors, maxiter;
extern int ytop, ybottom, xleft, xright;
extern double xxmin, xxmax, yymin, yymax;
extern int fractype;
extern int calc_status;
extern double param[4];
extern int inside, outside, biomorph, decomp, debugflag;
extern int usr_stdcalcmode, usr_floatflag;
extern int invert; /* non-zero if inversion active */
extern double inversion[3]; /* radius, xcenter, ycenter */
int tempfractype;
int tempcolors;
char tempstdcalcmode, tempfloatflag;
int numparams,numtrig;
static char *trg[] = {"First Function","Second Function",
"Third Function","Fourth Function"};
static int paramt[] = {ID_FRACPARTX1, ID_FRACPARTX2,
ID_FRACPARTX3, ID_FRACPARTX4 };
static int paramv[] = {ID_FRACPARAM1, ID_FRACPARAM2,
ID_FRACPARAM3, ID_FRACPARAM4, };
extern int win_release;
extern char win_comment[];
extern char DialogTitle[];
/****************************************************************************
FUNCTION: About(HWND, unsigned, WORD, LONG)
PURPOSE: Processes messages for "About" dialog box
MESSAGES:
WM_INITDIALOG - initialize dialog box
WM_COMMAND - Input received
****************************************************************************/
BOOL FAR PASCAL About(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
float temp;
char tempname[40];
switch (message) {
case WM_KEYDOWN:
switch (wParam) {
case VK_F1:
/* F1, shifted F1 bring up the Help Index */
WinHelp(hwnd,szHelpFileName,HELP_INDEX,0L);
break;
}
case WM_INITDIALOG:
temp = win_release / 100.0;
sprintf(tempname,"Fractint for Windows - Vers %5.2f", temp);
SetDlgItemText(hDlg, ID_VERSION,tempname);
SetDlgItemText(hDlg, ID_COMMENT,win_comment);
return (TRUE);
case WM_COMMAND:
if (wParam == IDOK
|| wParam == IDCANCEL) {
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
}
/****************************************************************************
FUNCTION: Status(HWND, unsigned, WORD, LONG)
PURPOSE: Processes messages for "Status" dialog box
MESSAGES:
WM_INITDIALOG - initialize dialog box
WM_COMMAND - Input received
****************************************************************************/
BOOL FAR PASCAL Status(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
char tempstring[100];
int i, j;
switch (message) {
case WM_KEYDOWN:
switch (wParam) {
case VK_F1:
/* F1, shifted F1 bring up the Help Index */
WinHelp(hwnd,szHelpFileName,HELP_INDEX,0L);
break;
}
case WM_INITDIALOG:
sprintf(tempstring,"fractal type: ");
strcat(tempstring, fractalspecific[fractype].name);
if (calc_status == 1)
strcat(tempstring," (still being calculated)");
else
strcat(tempstring," (interrupted/completed)");
/* ##### */
SetDlgItemText(hDlg, IDS_LINE1,tempstring);
if(fractalspecific[fractype].param[0][0] == 0)
tempstring[0] = 0;
else
sprintf(tempstring,"%-30.30s %14.10f",
fractalspecific[fractype].param[0], param[0]);
SetDlgItemText(hDlg, IDS_LINE2,tempstring);
if(fractalspecific[fractype].param[1][0] == 0)
tempstring[0] = 0;
else
sprintf(tempstring,"%-30.30s %14.10f",
fractalspecific[fractype].param[1], param[1]);
SetDlgItemText(hDlg, IDS_LINE3,tempstring);
if(fractalspecific[fractype].param[2][0] == 0)
tempstring[0] = 0;
else
sprintf(tempstring,"%-30.30s %14.10f",
fractalspecific[fractype].param[2], param[2]);
SetDlgItemText(hDlg, IDS_LINE4,tempstring);
if(fractalspecific[fractype].param[3][0] == 0)
tempstring[0] = 0;
else
sprintf(tempstring,"%-30.30s %14.10f",
fractalspecific[fractype].param[3], param[3]);
SetDlgItemText(hDlg, IDS_LINE5,tempstring);
sprintf(tempstring,"Xmin: %25.16f", xxmin);
SetDlgItemText(hDlg, IDS_LINE6,tempstring);
sprintf(tempstring,"Xmax: %25.16f", xxmax);
SetDlgItemText(hDlg, IDS_LINE7,tempstring);
sprintf(tempstring,"Ymin: %25.16f", yymin);
SetDlgItemText(hDlg, IDS_LINE8,tempstring);
sprintf(tempstring,"Ymax: %25.16f", yymax);
SetDlgItemText(hDlg, IDS_LINE9,tempstring);
return (TRUE);
case WM_COMMAND:
if (wParam == IDOK
|| wParam == IDCANCEL) {
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
}
/****************************************************************************
FUNCTION: SelectFractal(HWND, unsigned, WORD, LONG)
PURPOSE: Initializes window data and registers window class
****************************************************************************/
BOOL FAR PASCAL SelectFractal(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
int i;
int index;
switch (message) {
case WM_KEYDOWN:
switch (wParam) {
case VK_F1:
/* F1, shifted F1 bring up the Help Index */
WinHelp(hwnd,szHelpFileName,HELP_INDEX,0L);
break;
}
case WM_INITDIALOG:
SetDlgItemText(hDlg, ID_LISTTITLE, DialogTitle);
for (i = 0; i < win_numchoices; i++)
SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_ADDSTRING,
NULL, (LONG) (LPSTR) win_choices[i]);
SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_SETCURSEL,
win_choicemade, 0L);
return (TRUE);
break;
case WM_COMMAND:
switch (wParam) {
case IDOK:
okay:
index=SendDlgItemMessage(hDlg, IDM_FRACTAL,
LB_GETCURSEL, 0, 0L);
if (index == LB_ERR) {
MessageBox(hDlg, "No Choice selected",
"Select From a List", MB_OK | MB_ICONEXCLAMATION);
break;
}
win_choicemade = index;
EndDialog(hDlg, 1);
break;
case IDCANCEL:
win_choicemade = -1;
EndDialog(hDlg, 0);
break;